﻿<UserControl x:Class="WGMClient.Controls.InternalChatControl"
    xmlns:localcontrols="clr-namespace:WGMClient.Controls"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Margin="0,0,25,25" 
    xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
    >
    
    <Grid AllowDrop="True" >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="160*" />            
            <RowDefinition Height="2" />
            <RowDefinition Height="80*" />
        </Grid.RowDefinitions>
        <localcontrols:BackgroundTextBlock  BorderRadius="5,5,0,0" OuterBorderRadius="5,5,0,0" ImageOnLeft="True" ImageMargin="0,0,5,0"  BackgroundImage="..\Images\blank.png"  ImageGlowColor="LightGray" ImageHeight="35" ImageWidth="35"  SubLabelForeground="#FF222222" SubLabelFontStyle="Italic" HasImage="True"   LabelForeground="Black" LabelFontFamily="Verdana"  BorderBackground="#0F000000"  LabelFontSize="14" TextMargin="3,0,3,0" x:Name="_contactInfo" VerticalAlignment="Top" />
        <Grid Grid.Row="1" Background="#4FFFFFFF" >
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <ScrollViewer x:Name="_messageScroller"  VerticalScrollBarVisibility="Auto"  HorizontalScrollBarVisibility="Disabled">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="auto"/>
                    </Grid.RowDefinitions>
                    <RichTextBox  ContextMenuOpening="OnContextOpening" AcceptsReturn="True" AllowDrop="True" Drop="OnDrop" Grid.Row="0" IsDocumentEnabled="True" x:Name="_incomingTB" Background="Transparent" IsReadOnly="True" VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Hidden" BorderThickness="0" >
                        <RichTextBox.Resources>
                            <Style TargetType="ContextMenu">
                                <Setter Property="SnapsToDevicePixels" Value="True"/>
                                <Setter Property="OverridesDefaultStyle" Value="True"/>
                                <Setter Property="Grid.IsSharedSizeScope" Value="true"/>
                                <Setter Property="HasDropShadow" Value="True"/>
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="ContextMenu">
                                            <Border Name="Border"   BorderBrush="Black"   BorderThickness="0" >
                                                <Border.Background>
                                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                        <GradientStop Color="Black" />
                                                        <GradientStop Color="LightGray" Offset="1"/>
                                                    </LinearGradientBrush>
                                                </Border.Background>
                                                <StackPanel IsItemsHost="True" Orientation="Horizontal"  KeyboardNavigation.DirectionalNavigation="Cycle"/>
                                            </Border>
                                            <ControlTemplate.Triggers>
                                                <Trigger Property="HasDropShadow" Value="true">
                                                    <Setter TargetName="Border" Property="Padding" Value="0,3,0,3"/>
                                                    <Setter TargetName="Border" Property="CornerRadius" Value="4"/>
                                                </Trigger>
                                            </ControlTemplate.Triggers>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </RichTextBox.Resources>
                        <RichTextBox.ContextMenu>
                            <ContextMenu >
                                <TextBlock Text="Copy" MouseLeftButtonDown="OnCopy"  Foreground="White"  HorizontalAlignment="Left"/>


                                <MenuItem Width="auto" Header="Search On Google" Click="OnSearchGoogleClick" Foreground="White" IsCheckable="False" HorizontalContentAlignment="Left" HorizontalAlignment="Left"/>
                                <MenuItem Width="auto" Header="Define" Click="OnDefineClick" Foreground="White" IsCheckable="False" HorizontalContentAlignment="Left" HorizontalAlignment="Left"/>

                            </ContextMenu>

                        </RichTextBox.ContextMenu>
                    </RichTextBox>
                    <TextBlock Name="_typingListTb" Text="" FontFamily="Verdana" FontSize="10" Margin="10,0,0,0" Foreground="Gray" Grid.Row="1"/>

                </Grid>


            </ScrollViewer>
            <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">

                <TextBlock Text="Send File" FontFamily="Verdana" FontSize="10" Margin="10,0,0,0" Foreground="Black" Cursor="Hand" MouseLeftButtonDown="OnSendFile"/>
                <TextBlock Text="Clear messages" FontFamily="Verdana" Margin="10,0,0,0" FontSize="10" Foreground="Black" Cursor="Hand" MouseLeftButtonDown="OnClearMessages"/>
                <CheckBox x:Name="_scrollMessagesCB" Margin="10,0,0,0" IsChecked="True">
                    <TextBlock Text="Autoscroll messages" FontFamily="Verdana" FontSize="10" Foreground="Black" />
                </CheckBox>
                <CheckBox x:Name="_playSoundChk" Margin="10,0,0,0" IsChecked="False" Checked="OnSoundChk" Unchecked="OnSoundChk">
                    <TextBlock Text="Play sound when message received" FontFamily="Verdana" FontSize="10" Foreground="Black" />
                </CheckBox>
            </StackPanel>
        </Grid>


        <GridSplitter  Grid.Row="2" ResizeBehavior="PreviousAndNext" HorizontalAlignment="Stretch" Height="2">
            <GridSplitter.Background>
                <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
                    <GradientStop Color="Transparent" Offset="0"/>
                    <GradientStop Color="#40000000" Offset="0.5"/>
                    <GradientStop Color="Transparent" Offset="1"/>
                </LinearGradientBrush>
            </GridSplitter.Background>
        </GridSplitter>
        <RichTextBox IsDocumentEnabled="True" PreviewDragEnter="OnDragOver" PreviewDragOver="OnDragOver" AllowDrop="True" Drop="OnDrop" SpellCheck.IsEnabled="True" IsUndoEnabled="True" Grid.Row="3" x:Name="_outgoingTB" Background="#4FFFFFFF"  VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden" BorderThickness="0" KeyUp="OnOutgoingKeyUp" />


    </Grid>
    
</UserControl>
